1. Field of the Invention
The present invention relates to computer software, and deals more particularly with a method, system, and computer program product for programmatically manipulating a user interface process to maintain synchronization of object-oriented programming language methods (or xe2x80x9cscriptsxe2x80x9d) during a rollback operation in a procedural logic debugger.
2. Description of the Related Art
Many modern program development environments include both object-oriented (OO) components and traditional non-object-oriented (non-OO) or procedural programming language constructs. The OO components are often used in the user interface. They may also be the main data objects that describe the business system (e.g. Customer objects, Order objects, and so forth in a customer ordering application). The business logic of the application, however, might not be written using an OO language, but might be written instead in a more traditional procedural programming language. It might even be legacy code that only uses OO objects by introduction of a new graphical user interface (GUI). The OO and procedural constructs might even execute in two completely different processes and namespaces.
A problem arises when developers need to merge the OO and non-OO technologies in a productive way. In addition to development concerns (which are addressed in the first related application) when application environments include a mix of OO objects and non-OO programming language constructs, a number of challenges are also introduced for the testing of these mixed application environments. Many interactive test facilities, or xe2x80x9ctest debuggersxe2x80x9d, provide features that allow users to animate (i.e. display, and step through the logic of) the business logic which is invoked by GUI applications, where that business logic is often written in a procedural programming language. This is typically done using an event-driven facility which knows how to become active when a specific event from the graphical user interface causes invocation of a business logic code component. When the GUI event is triggered, a debugger for the procedural code is invoked. A window (referred to herein as a xe2x80x9ctest monitor windowxe2x80x9d) is then displayed to enable the developer to interact with and control the business logic debugging.
Developers are accustomed to being able to explicitly reposition a debugger, to cause execution of a code statement other than the one that would be executed next according to the logic flow of the underlying code. Existing non-integrated debuggers (OO code debuggers as well as non-OO code debuggers) typically provide the developer with a mechanism for backing up in the execution flow from one statement to a different statement in the subroutine or code component which is currently executing, or for positioning to a statement in a subroutine or code component other than the one currently executing. As an example of this type of mechanism, a graphical display of the debugger""s execution history may be provided, from which the developer can select to reposition execution to an earlier-executed component. Or, the code of a currently-executing function may be displayed in a graphical window, and the developer may be allowed to reposition to a previously executed code statement in that window. Explicitly repositioning the code statement that will execute next in this manner provides the developer with more control over the debugging process.
There may also be situations in which the developer dynamically makes code changes to the executing logic during the debugging process, where these code changes then cause the execution path to be automatically repositioned under control of the corresponding (i.e. OO or non-OO) debugging tool.
As the repositioning process (referred to equivalently herein as a rollback process) moves a current statement pointer for the non-OO code, it is desirable for the OO code to be simultaneously adjusted to remain synchronized with the non-OO code. In a mixed OO and non-OO environment, there are inter-relationships between the OO code being executed in a user interface (UI) process and the non-OO code executing in a non-OO process. For example, the non-OO code may have been invoked from an OO method, and the OO method may contain additional statements that are not to be executed until the invoked non-OO code completes. The OO code may also invoke other non-OO code components, and conversely the non-OO code may invoke other OO methods. There may even be recursive invocations between the OO and non-OO code. If the inter-relationships are not maintained during a repositioning operation, the debugging process becomes much more difficult as the developer will be presented with an execution scenario that is confusing and which does not accurately reflect the underlying code.
There are no prior art techniques known to the inventors that provide for programmatically repositioning the OO code while debugging in this type of mixed execution environment so that the OO code remains synchronized during a repositioning operation in the non-OO debugger.
The problem of integrating OO and non-OO languages was discussed in xe2x80x9cBridging traditional and object technologies: Creating transitional applicationsxe2x80x9d, A. H. Lindsey and P. R. Hoffnan, IBM Systems Journal, Vol. 36, No. 1, (1997), which focuses on rapid application development using visual programming and object-oriented techniques. With regard to the debugging task in an integrated environment, this paper states that it is xe2x80x9cparticularly unpleasantxe2x80x9d when developers are required to perform debugging across language (i.e. OO and non-OO) boundaries. Id., fn 17. However, no techniques were proposed for dealing with the debugging issues.
U.S. Pat. No. 5,901,315, which is titled xe2x80x9cMethod for Debugging a Java Application Having Native Method Dynamic Load Librariesxe2x80x9d, discloses a technique for allowing simultaneous debugging of Java code and native (e.g. C or C++) dynamic load library (DLL) functions, wherein a single debugger interface is provided for both. However, there is no discussion of maintaining synchronization between OO and non-OO code in this patent.
Accordingly, what is needed is a technique for programmatically manipulating code of an OO user interface that executes in an integrated, seamless manner with procedural language code components such that the OO code remains properly synchronized with the procedural language code when a repositioning operation occurs during operation of a procedural code debugger.
This programmatic synchronization should be provided even though the OO code and procedural components may be executing in different processes, different namespaces, and/or different software products.
An object of the present invention is to provide a technique for programmatically manipulating code of an OO user interface that executes in an integrated, seamless manner with procedural language code components such that the OO code remains properly synchronized with the procedural language code when a repositioning operation occurs during operation of a code debugger.
A further object of the present invention is to provide a technique for programmatic synchronization of object-oriented code and procedural language code components even though the methods and procedural components may be executing in different processes, different namespaces, and/or different software products.
Still another object of the present invention is to provide this technique for programmatic synchronization in response to an explicit developer-initiated repositioning action during debugging.
Another object of the present invention is to provide this technique for programmatic synchronization in response to a repositioning action initiated by a test debugger tool.
Yet another object of the present invention is to provide this technique for programmatic synchronization in an integrated debugging environment where control efficiently passes back and forth between object-oriented code execution and procedural language code execution.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a method, system, and computer program product for programmatically maintaining synchronization of object-oriented code during a repositioning operation occurring in a procedural language code debugger. This technique comprises: executing one or more object-oriented methods written in an object-oriented programming language; executing, under control of the procedural language code debugger, one or more procedural components written in a procedural programming language, wherein at least one of the procedural components contains one or more references to selected ones of the object-oriented methods; detecting a rollback of execution, in the procedural language code debugger, to a particular procedural component; determining whether any currently executing object-oriented methods should be rolled back, based upon the particular procedural component; and rolling back one or more of the currently executing object-oriented methods accordingly.
The determination may further comprise interrogating a stack which comprises an element for each currently executing object-oriented method invoked by one or more currently executing procedural components, and determining (during the interrogation) whether an element corresponding to the particular procedural component is present on the stack. The rolling back may further comprise: popping all stack elements up to the corresponding element, if the corresponding element is present, or up through an element next preceding where the corresponding element would have been on the stack, otherwise; finding a set of frames on a user interface process stack where the set comprises those referencing a name of an object-oriented method that was invoked by the particular procedural component; positioning to a selected one of the set of frames, wherein the selected one is that which precedes an invocation of the object-oriented method having the name; and removing all frames from the user interface process stack up to the selected one.
The procedural language code, debugger and the object-oriented method may operate in different processes, different software products, and/or in different namespaces.
The detecting may further comprise detecting a user-initiated rollback, or detecting a rollback initiated by the procedural language code debugger.